{% load i18n %}
{% load djblets_utils %}

{% ifequal review_request.status 'S' %}
<div class="banner" id="submitted-banner">
 <h1>{% trans "This change has been marked as submitted." %}</h1>
{% ifuserorperm review_request.submitter "reviews.can_change_status" %}
 <input type="submit" id="btn-review-request-reopen"
  value="{% trans "Reopen for Review" %}" />
{% endifuserorperm %}
</div>
{% else %}
{%  ifequal review_request.status 'D' %}
<div class="banner" id="discard-banner">
 <h1>{% trans "This change has been discarded." %}</h1>
{% ifequal request.user review_request.submitter %}
 <input type="submit" id="btn-review-request-reopen"
  value="{% trans "Reopen for Review" %}" />
{% endifequal %}
</div>
{%  else %}
{%  ifuserorperm review_request.submitter "reviews.can_edit_reviewrequest" %}
<div class="banner" id="draft-banner" style="display:none;">
{%    if review_request.public %}
 <h1>{% trans "This review request is a draft." %}</h1>
 {% trans "Be sure to publish when finished." %}
 <input type="button" id="btn-draft-publish"
  value="{% trans "Publish Changes" %}" />
 <input type="button" id="btn-draft-discard"
  value="{% trans "Discard Draft" %}" />
 <p><label for="changedescription">{% trans "Describe your changes (optional):" %}</label></p>
 <pre id="changedescription" class="editable">{% if draft.changedesc %}{{draft.changedesc.text}}{% endif %}</pre>
{%    else %}
 <h1>{% trans "This review request is not yet public." %}</h1>
 {% trans "Be sure to publish when finished." %}
 <input type="button" id="btn-draft-publish"
  value="{% trans "Publish" %}" />
 <input type="button" id="btn-review-request-discard"
  value="{% trans "Discard Review Request" %}" />
{%    endif %}
{%   endifuserorperm %}
</div>
{%  endifequal %}
{% endifequal %}

{% ifuserorperm review_request.submitter "reviews.can_edit_reviewrequest" %}
{% ifequal review_request.status 'P' %}
<script type="text/javascript">
    $(document).ready(function() {
{% if draft or not review_request.public %}
        $("#draft-banner").show();
{% else %}
        $("#draft-banner").hide();
{% endif %}
    });
</script>
{% endifequal %}
{% endifuserorperm %}
